//
//  BVReceviceAddressCell2.m
//  BuyVegetables1
//
//  Created by zhuzi on 16/11/8.
//  Copyright © 2016年 YSC. All rights reserved.
//

#import "BVReceviceAddressCell.h"
#import "BVConst.h"

@implementation BVReceviceAddressCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setUI];
    }
    return self;
}
/**     
 设置布局
 */
-(void)setUI{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = BVBackgroundLightGrayColor;
    
    self.nameLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.font = [UIFont systemFontOfSize:14];
    self.nameLabel.textColor = BVBaseTextBlackColor;
    self.nameLabel.sd_layout
    .topSpaceToView(self.contentView,10)
    .leftSpaceToView(self.contentView,20)
    .heightIs(20);
    [self.nameLabel setSingleLineAutoResizeWithMaxWidth:100];

    
    self.telLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.telLabel];
    self.nameLabel.font = [UIFont systemFontOfSize:14];
    self.nameLabel.textColor = BVBaseTextBlackColor;
    self.telLabel.sd_layout
    .topSpaceToView(self.contentView,10)
    .leftSpaceToView(self.nameLabel,10)
    .rightSpaceToView(self.contentView,60)
    .heightIs(20);
    
    self.addressLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.addressLabel];
    self.addressLabel.font = [UIFont systemFontOfSize:14];
    self.addressLabel.textColor = BVBaseTextBlackColor;
    self.addressLabel.sd_layout
    .topSpaceToView(self.nameLabel,10)
    .leftSpaceToView(self.contentView,20)
    .rightSpaceToView(self.contentView,60)
    .autoHeightRatio(0);
    
    UIImageView * linImg = [[UIImageView alloc]init];
    [self.contentView addSubview:linImg];
    linImg.image = [UIImage imageNamed:@"tiao"];
    linImg.sd_layout
    .leftSpaceToView(self.contentView,10)
    .rightSpaceToView(self.contentView,10)
    .heightIs(3)
    .bottomSpaceToView(self.contentView,0);
    
    self.businessLabelC = [[UILabel alloc]init];
    [self.contentView addSubview:self.businessLabelC];
    self.businessLabelC.font = [UIFont systemFontOfSize:14];
    self.businessLabelC.textColor = BVBaseTextBlackColor;
    self.businessLabelC.sd_layout
    .topSpaceToView(self.addressLabel,10)
    .leftSpaceToView(self.contentView,20)
    .rightSpaceToView(self.contentView,60)
    .heightIs(20);
    
    //修改按钮
    self.modifyAddresButton = [[UIButton alloc]init];
    [self.contentView addSubview:self.modifyAddresButton];
    [self.modifyAddresButton setImage:[UIImage imageNamed:@"xxshdz_edit"] forState:UIControlStateNormal];
    self.modifyAddresButton.sd_layout
    .topSpaceToView(self.contentView,10)
    .rightSpaceToView(self.contentView,10)
    .bottomSpaceToView(self.contentView,10)
    .widthIs(50);
    
    CGFloat margin = 5;
    [self setupAutoHeightWithBottomViewsArray:@[self.nameLabel,self.telLabel,self.addressLabel,linImg,self.modifyAddresButton,self.businessLabelC] bottomMargin:margin];
}

@end
